using StructureMap.Configuration.DSL;
using Yala.DataAccess.Common.Nhibernate.Repositories;
using NHibernate;
using Yala.UnitTest;
using Yala.Models.AuthProviders;
using Yala.Models.Users;
using Yala.Models.Items;
using Yala.DataAccess.Common.EF.Repositories;

namespace Yala.UnitTests.IocSetup {
    public class RepositoriesRegistry : Registry {
        public RepositoriesRegistry() {
            For<ISessionFactory>().Singleton().Use(m => NhFactory.CreateSessionFactory());
            For<ISession>().Use(m => m.GetInstance<ISessionFactory>().OpenSession());
            For<IAuthProvidersRepository>().Use<EFAuthProvidersRepository>();
            For<IUsersRepository>().Use<EFUsersRepository>();
            For<IItemsRepository>().Use<EFItemsRepository>();
        }
    }
}
